<?php
class PromotionController extends Apps_Controller_Action_Default {
    public function indexAction() {
        //list tour promotion
        $tourModel = new M_Tour();
        $listTour  = $tourModel->listPromotionTour(12)->query()->fetchAll();
        $this->view->listPromotionTour = $listTour;

        //list cruise promotion
        $cruiseItineraryTourModel = new M_CruiseItineraryTour();
        $listCruiseItineraryTour  = $cruiseItineraryTourModel->listCruiseTourByType(null, 'special_offer', 12)->query()->fetchAll();
        $this->view->listPromotionCruise = $listCruiseItineraryTour;
    }

    public function typeAction() {
        $type = intval($this->_request->getParam('type'));
        switch ($type) {
            case 1: //tour
                $tourModel   = new M_Tour();
                $listTour  = $tourModel->listPromotionTour(false);
                $this->setPagination($listTour, $this->_request);
                $this->view->title = 'List_Promotion_Tour';
            break;
            case 2: //cruise
                $cruiseItineraryTourModel = new M_CruiseItineraryTour();
        		$listCruiseItineraryTour  = $cruiseItineraryTourModel->listCruiseTourByType(null, 'special_offer');
                $this->setPagination($listCruiseItineraryTour, $this->_request);
                $this->view->title = 'List_Promotion_Cruise';
            break;
        }
        $this->view->type = $type;
    }
}